*** Politial Schock and International Students: Estiamting the "Trump Effect"**
*** Mingsi Song***
***mingsi@tamu.edu****

***This file is used to execute pairwise DID estimates which generates Figure 2, Figure 3, and Figure 4. 
clear all
capture log close
set more off

** set your working directory
* capture cd set your working directory
** capture use "trumpeffect.dta"
capture use "trumpeffect.dta"



**** pairwise results 

levelsof cowc_host, local(areas)

foreach a of local areas {
ppmlhdfe number  US trump ustrump gdp_pc_ratio lnpop_home lnpop_host if cowc_host == "USA" | cowc_host == "`a'" & year != 2016, absorb(id year) cluster(id) nolog
estimates store `a', title(`a')

}

*** export to an excel file, and import to R for Figure 2, Figure 2, and Figure 4. 
estout _all using pairwise.xls, cells(b(fmt(4)) ci_l(fmt(4))  ci_u(fmt(4))) legend keep(ustrump)
